#pragma once


class TwRefRoot
{
public:
	TwRefRoot(void):m_nRefCount(1)
	{
	}

	~TwRefRoot(void)
	{
		DecRef();
		if(m_nRefCount == 0)
			Destroy();
	}


	virtual void Destroy() {};

	virtual void AddRef()
	{
		m_nRefCount++;
	}
	virtual void DecRef()
	{
		m_nRefCount--;
	}
protected:
	TwRefRoot(const TwRefRoot& root);
	TwRefRoot& operator =(const TwRefRoot& root);
private:
	int m_nRefCount;
};
